package starters

import (
	"gitee.com/xlizy/common-go/components/dlock"
	"gitee.com/xlizy/common-go/components/nacos/v2"
	"gitee.com/xlizy/common-go/components/orm"
	"gitee.com/xlizy/common-go/components/oss"
	"gitee.com/xlizy/common-go/components/redis"
	"gitee.com/xlizy/common-go/components/tencent_captcha"
)

// EnableRedis 启用redis组件
func EnableRedis() {
	redisConfig := redis.NewConfig()
	nacos.LoadConfig(redisConfig)
	redis.InitRedis(redisConfig)
}

// EnableOrm 启用orm组件
func EnableOrm() {
	ormConfig := orm.NewConfig()
	nacos.LoadConfig(ormConfig)
	orm.InitOrm(ormConfig)
}

// EnableOss 启用oss组件
func EnableOss() {
	ossConfig := oss.NewConfig()
	nacos.LoadConfig(ossConfig)
	nacos.AddListen(ossConfig)
	oss.InitOSS(ossConfig)
}

// EnableTencentCaptcha 启用腾讯验证码组件
func EnableTencentCaptcha() {
	tencentCaptchaConfig := tencent_captcha.NewConfig()
	nacos.LoadConfig(tencentCaptchaConfig)
	nacos.AddListen(tencentCaptchaConfig)
	tencent_captcha.InitTencentCaptcha(tencentCaptchaConfig)
}

// EnableDLock 启用分布式锁组件
func EnableDLock() {
	dLockConfig := dlock.NewConfig()
	nacos.LoadConfig(dLockConfig)
	dlock.InitDLock(dLockConfig)
}
